using Autenticazione;
using System;
namespace BusinessObject
{
	public class Utente
	{
		public string EMail;
		public string Password;
		public Utente()
		{
		}
		public Utente(string email, string password)
		{
			this.EMail = email;
			this.Password = password;
		}
		public bool UtenteEsistente()
		{
			string strSQL = string.Format("select count(*) from Utente where Email = '{0}'", this.EMail);
			DB db = new DB();
			return db.ExecuteScalar(strSQL) > 0;
		}
		public bool VerificaUtente()
		{
			string strSQL = string.Format("select count(*) from Utente where Email = '{0}' and Password = '{1}'", this.EMail, Tools.CryptText(this.Password));
			DB db = new DB();
			return db.ExecuteScalar(strSQL) > 0;
		}
		public bool Salva()
		{
			string strSQL = string.Format("insert into Utente values ('{0}','{1}')", this.EMail, Tools.CryptText(this.Password));
			DB db = new DB();
			return db.ExecuteNonQuery(strSQL);
		}
	}
}
